package com.imooc.mymall.domain.dto;

import com.imooc.mymall.util.InsertValidationGroup;
import com.imooc.mymall.util.UpdateValidationGroup;
import lombok.Data;
import org.apache.ibatis.annotations.Update;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <h1>用户DTO</h1>
 * @Author: crowsjian
 * @Date: 2020/7/11 13:58
 */
@Data
public class UserDTO implements Serializable {

    private static final long serialVersionUID = -1233700778506808845L;
    /*用户名*/
    @NotBlank(message = "用户名不能为空！",groups = {InsertValidationGroup.class})
    private String username;
    /*密码*/
    @NotBlank(message = "密码不能为空！",groups = {InsertValidationGroup.class})
    @Length(min = 6,max = 18,message = "密码长度不能小于6位，不能多余18位！")
    private String password;
    /*邮箱*/
    @NotEmpty(message = "邮箱不能为空！",groups = {InsertValidationGroup.class})
    @Email(message = "必须位有效邮箱！")
    private String email;
    /*年龄*/
    @NotNull(message = "年龄不能为空",groups = {InsertValidationGroup.class})
    @Max(value = 80,message = "年龄不能大于18岁！")
    @Min(value = 18,message = "年龄不能小于18岁！")
    private Integer age;
    /*手机号*/
    @NotBlank(message = "手机号不能为空！",groups = {InsertValidationGroup.class})
    private String phone;
    /*版本号*/
    @NotNull(message = "版本号不能为空！",groups = {UpdateValidationGroup.class})
    private Long version;

    /**
     * 创建时间
     */
    private LocalDateTime created;
}
